import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class C_1580 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String in = sc.next();
        char[] ins = in.toCharArray();
        int max = 0;
        List<Character> list = new ArrayList<>();
        for (char i:ins){
            list.add(i);
        }
        List<Character> temp = new ArrayList<>(list);
        int s = list.size();
        for (int i = 0; i < s; i++) {
            int now = 0;
            list = new ArrayList<>(temp);
            char t = list.get(0);
            list.remove(0);
            list.add(t);
            temp = new ArrayList<>(list);
            char first = 'a',last = 'a';
            for(char a:list){
                if (a!='w'){
                    first = a;
                    break;
                }
            }
            for (int j = 0; j < list.size(); j++) {
                if (list.get(list.size()-1-j)!='w'){
                    last = list.get(list.size()-1-j);
                    break;
                }
            }
            int size = list.size();
            for (int j = 0; j < size; j++) {
                if (list.get(0)==first || list.get(0)=='w'){
                    now++;
                    list.remove(0);
                }else break;
            }
            size = list.size();
            for (int j = 0; j < size; j++) {
                if (last==list.get(list.size()-1) || 'w'==list.get(list.size()-1)){
                    now++;
                    list.remove(list.size()-1);
                }else break;
            }
            max = Math.max(max,now);
        }
        System.out.println(max);
    }
}
